<template>
	<view class="evaluate">
		<el-tabs v-model="active" @tab-click="handleClick">
			<el-tab-pane :label="`全部(${data.length})`" name="1"><evaluateChild :index='active' /></el-tab-pane>
			<el-tab-pane :label="`好评(${data.length})`" name="2"><evaluateChild :index='active' /></el-tab-pane>
			<el-tab-pane :label="`有图(${imgData.length})`" name="3"><evaluateChild :index='active' /></el-tab-pane>
		</el-tabs>
	</view>
</template>

<script>
	import evaluateChild from '@/pages/person/evaluateChild.vue'
	export default {
		data() {
			return {
				active: "1",
				data: [],
				imgData: []
			};
		},
		components: {
			evaluateChild
		},
		methods: {
			handleClick(tab, event) {
				// console.log(this.active)
			},
		},
		created() {
			const userId = getApp().globalData.userId
			if(userId) {
				this.$api.getCommentUserId(userId).then(res => {
					// console.log(res)
					if(res.code == 200) {
						this.data = res.data
						this.imgData = res.data.filter(item => item.commentImg !== null)
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.evaluate{
		width: 100%;
	}

</style>
